/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.sais.eswn.card;

import org.sais.eswn.tool.Tools;

/**
 *
 * @author Romulus
 */
public class Bullet {
    private int[] attributes = new int[5];

    public Bullet() {
    }

    public Bullet(int A, int B, int C, int D, int E) {
        attributes[0] = A;
        attributes[1] = B;
        attributes[2] = C;
        attributes[3] = D;
        attributes[4] = E;
    }

    public void add(String rawText) {
        for (int i=0;i<5;++i) {
            if (Tools.getLoc(i).equals(rawText)) {
                attributes[i]++;
                break;
            }
        }
    }

    public String getShortDisplayText() {
        String ret = "";
        for (int i=0;i<5;++i) {
            for (int j=0;j<attributes[i];++j) {
                ret += Tools.getLoc(i).charAt(0);
            }
        }
        return ret;
    }

    public String getDisplayText() {
        String ret = "";
        for (int i=0;i<5;++i) {
            for (int j=0;j<attributes[i];++j) {
                ret += Tools.getLoc(i) + " ";
            }
        }
        if (ret.length() > 0) {
            ret = ret.substring(0, ret.length() - 1);
        }
        return ret;
    }

    public boolean hasBullet(int attr) {
        return attributes[attr] > 0;
    }
    
}
